
<!--本页为登陆页面-->
<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>皮皮虾管理平台</title>

    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="font-awesome/css/font-awesome.css" rel="stylesheet">
    <!-- Ladda style -->
    <link href="css/plugins/ladda/ladda-themeless.min.css" rel="stylesheet">
    <!-- Sweet Alert -->
    <link href="css/plugins/sweetalert/sweetalert.css" rel="stylesheet">

    <link href="css/animate.css" rel="stylesheet">
    <link href="css/style.css" rel="stylesheet">
    <!-- 获取ip -->
    <script src="http://pv.sohu.com/cityjson?ie=utf-8"></script>
</head>

<body class="gray-bg">

    <div class="middle-box text-center loginscreen animated fadeInDown">
        <div>
            <div>
                 <!--此处LOGO需要修改-->
                <!--<img src="images/yunbaba-logo2.png" alt="" srcset="">-->

            </div>
            <p class="m-t-lg"><h2><strong>皮皮虾管理平台</strong></h2></p>
            <div class="m-t">
                <div class="form-group">
                    <input type="text" id="username" class="form-control" placeholder="账户" required="">
                </div>
                <div class="form-group">
                    <input type="password" id="password" class="form-control" placeholder="密码" required="">
                </div>
                <button type="button" data-style="zoom-in" id="login_btn" class="ladda-button ladda-button-demo btn btn-primary block full-width m-b">进入系统</button>
                <!-- <a href="login.html#"><big>忘记密码</big></a>
                <a class="m-l" href="regist.html"><big>注册账户</big></a> -->
                <a href="user_management/modify_pass.html#"><small>忘记密码</small></a>
                <!--<a class="m-l" href="register.html#"><small>注册账户</small></a>-->
            </div>

            <!--<p class="m-t"> http://www.hnstf.org </p>-->
        </div>
    </div>
    <!-- Mainly scripts -->
    <script src="js/jquery-3.1.1.min.js"></script>
    <!-- <script src="js/bootstrap.min.js"></script> -->

    <!-- Sweet alert -->
    <script src="js/plugins/sweetalert/sweetalert.min.js"></script>


    <script src="js/plugins/jquery-mockjax/jquery.mockjax.min.js"></script>
    <script src="js/jquery.cookie.js"></script>
    <script src="js/main.js?v1.0"></script>
    <script src="./service.mock.js"></script>

    <!-- Ladda -->
    <script src="js/plugins/ladda/spin.min.js"></script>
    <script src="js/plugins/ladda/ladda.min.js"></script>
    <script src="js/plugins/ladda/ladda.jquery.min.js"></script>

    <script>
        $(document).ready(function() {

            // Bind progress buttons and simulate loading progress
            Ladda.bind('.ladda-button', {
                callback: function(instance) {
                    var progress = 0;
                    var interval = setInterval(function() {
                        progress = Math.min(progress + Math.random() * 0.1, 1);
                        instance.setProgress(progress);
                        if (progress === 1) {
                            login(instance)
                            clearInterval(interval);
                        }
                    }, 200);
                    login(instance);

                }
            });

        });
        function login(instance) {
            var user = getUserJson($('#username').val(),$('#password').val(),returnCitySN["cip"],returnCitySN["cname"]);
            $.getJSON({
                    url: bathpath + '/systemUser/login',
                    contentType: "application/json; charset=utf-8",
                    type: 'post',
                    data: {
                        username: $('#username').val(),
                        password: $('#password').val()
                    },
                    dataType: "json", 
                    data: user
                })
                .done(function(data) {
                    if (ajaxdatacheck(data)) {
                        if (data.code == 1) {
                            swal({
                                title: '登录成功',
                                text: '欢迎'+data.content.user.userName,
                                type: "warning"
                            }, function() {
                                $.cookie('user', JSON.stringify(data.content.user), {
                                    expires: 8 / 24
                                })
                                $.cookie('sessionToken', data.content.sessionToken, {
                                    expires: 8 / 24
                                })
                                window.setTimeout("window.location.href = 'index.html?_" + new Date().getTime() + "'", 200)
                            })
                        } else {
                            swal({
                                title: '出错了',
                                text: data.errorMsg || data.msg,
                                type: "warning"
                            })
                        }
                    }
                })
                .fail(function(e) {
                    console.error(e.statusText)
                })
                .always(function() {
                    if (instance)
                        instance.stop();
                })
        }
        function getUserJson(userName,password,loginIp,loginAddress){
             var user = {
                "userName":userName,
                "password":password
             };
             return JSON.stringify(user);
        }
    </script>
</body>

</html>`